//
//  NetWork.h
//  HongQiao
//
//  Created by maple on 16/11/30.
//  Copyright © 2016年 MapleDongSen. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NetWork : NSObject

/** 成功回调 state = 0 */
typedef void(^SuccessCallBack)(NSDictionary * dic);
/** 错误回调 */
typedef void(^ErrorCallBack)(id error);
/** 失败 state ！= 0 */
typedef void(^FailureCallBack)(NSString * msg);

typedef void(^PhotoSuccessCallBack)(NSString *imagePath);
/**
 *  post请求
 *
 *  @param url        地址
 *  @param dicback    成功回调data内容
 *  @param msgback    成功但state ！=1
 *  @param errorblock 失败回调
 */

+(void)PostNetWorkWithUrl:(NSString*)url with:(NSDictionary*)dic successBlock:(SuccessCallBack)dicback FailureBlock:(FailureCallBack)msgback errorBlock:(ErrorCallBack)errorblock;

/**
 *  get 请求
 *
 *  @param url        地址
 *  @param data       参数
 *  @param dicback    成功回调data内容
 *  @param msgback    成功但state ！=1
 *  @param errorblock 失败回调
 */

+(void)GetNetWorkWithUrl:(NSString*)url with:(NSDictionary*)dic successBlock:(SuccessCallBack)dicback FailureBlock:(FailureCallBack)msgback errorBlock:(ErrorCallBack)errorblock;

/**
 *  上传图片
 *
 *  @param msgback    state ！=1
 *  @param errorblock error回调
 */

+ (void)PostUpLoadImageWithImages:(NSArray *)images withID:(NSString *)prudectId successBlock:(PhotoSuccessCallBack)dicback FailureBlock:(FailureCallBack)msgback errorBlock:(ErrorCallBack)errorblock;


+ (void)PostUpLoadImageWithImages:(UIImage *)image index:(NSInteger )index pid:(NSString *)pid successBlock:(PhotoSuccessCallBack)dicback FailureBlock:(FailureCallBack)msgback errorBlock:(ErrorCallBack)errorblock;
/**
 *  上传语音 *
 */
+ (void)PostUpLoadAudioWithData:(NSData *)audiodata successBlock:(PhotoSuccessCallBack)dicback FailureBlock:(FailureCallBack)msgback errorBlock:(ErrorCallBack)errorblock;

@end
